import { http } from '@/utils/http'
import type { product } from '@/types/center'
import type { userItem } from "@/types/userform"
export const getProductAPI = (account: string | null) => {
  return http<product[]>({
    url: `/user/works?account=${account}`,
    method: 'GET'
  })
}
export const getDraftAPI = (account: string | null) => {
  return http<product[]>({
    url: `/user/drafts?account=${account}`,
    method: 'GET'
  })
}
export const getFavoriteAPI = (account: string | null) => {
  return http<product[]>({
    url: `/user/historyFavorite?account=${account}`,
    method: 'GET'
  })
}
export const getLikeAPI = (account: string | null) => {
  return http<product[]>({
    url: `/user/historyLike?account=${account}`,
    method: 'GET'
  })
}
export const getHistoryAPI = (account: string | null) => {
  return http<product[]>({
    url: `/user/historyView?account=${account}`,
    method: 'GET'
  })
}
export const modifyUserInfo = (data: userItem) => {
  return http<userItem>({
    url: `/user/modifyUserInfo?account=${data.account}&avatar=${data.avatar}&username=${data.username}&address=${data.address}&sex=${data.sex}&userInfo=${data.userInfo}`,
    method: 'PUT',
  })
}
